package com.yongnuo.support;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

import com.yongnuo.remoteconlight.R;

public class WarningDialog {

	private Context context;
	private String title;
	private String content;
	private boolean isShow = false;
	private AlertDialog mAlertDialog;
	
	public WarningDialog(Context context, String title,String content) {
		super();
		this.context = context;
		this.title = title;
		this.content = content;
		mAlertDialog = create();
	}
	
	public WarningDialog(Context context, int title,int content) {
		super();
		this.context = context;
		this.title = context.getResources().getString(title);
		this.content = context.getResources().getString(content);
		mAlertDialog = create();
	}
	
	public AlertDialog create(){
		return new AlertDialog.Builder(context).setTitle(title)
		.setMessage(content)
		.setPositiveButton(context.getResources().getString(R.string.conform), 
				new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				
			}
		}).create();
	}
	public void show(){
		if(isShow){
			return;
		}
		mAlertDialog.show();
		isShow = true;
	}
	public void dismiss(){
		if(!isShow){
			return;
		}
		mAlertDialog.dismiss();
		isShow = false;
	}
}
